home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / mebbs / dizlist.lha / AFTERUP.REXX next >
OS/2 REXX Batch file  |  1994-06-16  |  4KB  |  173 lines

  1. /* FILEID.DIZ searcher - original by Larry Cloud */
  2. /* Modified by Keith Townsend */
  3.  
  4. /*
  5. signal on ERROR
  6. */
  7. parse arg LineNumber
  8. options results
  9. DoorName = "DIZLIST"
  10. author = "Keith Townsend"
  11. if( ~show( 'l', "mebbsarexx.library" ) )then do
  12.  if( ~addlib( "mebbsarexx.library", 0, -30, 0 ) )then do
  13.   say "Could not open library"
  14.   exit 10
  15.  end
  16. end
  17.  
  18. /* Open the config File */
  19.  
  20.  call open conf,('MEBBSNET:CONFIGFILES/DIZ.CFG'), 'R'
  21.     descpath = readln(conf)
  22.     tempath = readln(conf)
  23.     diztemp = readln(conf)
  24.  call close conf
  25.  
  26. filepath=tempath||"tmp"||linenumber
  27.  
  28.  
  29. string= ""
  30. call output
  31. string="Please stand by, Checking archive for long description file"
  32. call output
  33. string="This will just take a few seconds..."
  34. call output
  35. call carrier
  36.  
  37. address command "list "filepath" > t:filelist.txt lformat %n"
  38.  
  39. c=0
  40. call open(file,"t:filelist.txt","R")
  41. do until eof(file)
  42.  c=c+1
  43.  filename.c=readln(file)
  44. end
  45.  
  46. call close(file)
  47.  
  48. call carrier
  49.  
  50. do i=1 to c
  51.  
  52.  if upper(right(filename.i,4))=".LHA" then do
  53.   unstring="lha e "
  54.   estring=""
  55.   call doit
  56.  end
  57.  
  58.  if upper(right(filename.i,3))=".LZ" then do
  59.   unstring="lha e "
  60.   estring=""
  61.   call doit
  62.  end
  63.  
  64.  if upper(right(filename.i,4))=".LZH" then do
  65.   unstring="lha e "
  66.   estring=""
  67.   call doit
  68.  end
  69.  
  70.  if upper(right(filename.i,4))=".ZIP" then do
  71.   unstring="unzip -x "
  72.   estring=""
  73.   call doit
  74.  end
  75.  
  76.  if upper(right(filename.i,4))=".ARC" then do
  77.   unstring="arc e "
  78.   estring=""
  79.   call doit
  80.  end
  81.  
  82.  if upper(right(filename.i,4))=".ZOO" then do
  83.   unstring="booz x "
  84.   estring=""
  85.   call doit
  86.  end
  87.  
  88. if upper(right(filename.i,4))=".DMS" then do
  89.   unstring="DMS VIEWDIZ "
  90.   estring=" SAVE"
  91.   call doit
  92.  end
  93.  
  94. end
  95. address command "delete t:filelist.txt"
  96. address command "delete t:DIZLIST.BAT"
  97. address command "delete "||diztemp||Linenumber||"#?.#?"
  98. string="Thank You for using "||Doorname||" by "||Author
  99. call output
  100. string=""
  101. call output
  102. call Exit_Door DoorName,LineNumber
  103. exit 0
  104.  
  105. ERROR:
  106. address command "delete t:filelist.txt"
  107. address command "delete t:DIZLIST.BAT"
  108. address command "delete "||diztemp||Linenumber||"#?.#?"
  109. call Exit_Door DoorName,LineNumber
  110. exit 0
  111.  
  112. Carrier:
  113. call CDetect doorname,linenumber
  114. cd=upper(result)
  115. if cd="NO CARRIER!" then signal error
  116. return
  117.  
  118. doit:
  119.  
  120. call open Tfile,('T:DIZLIST.BAT'),'W'
  121. call writeln Tfile, "cd "||diztemp
  122. call writeln Tfile, "Copy "||filepath||"/"||filename.i||" to "||diztemp||""||Linenumber||filename.i
  123. call writeln Tfile, "wait 1"
  124. call writeln Tfile, unstring||Linenumber||filename.i||estring||" file_id.diz"
  125. call writeln Tfile, "wait 1"
  126. call writeln Tfile, "rename file_id.diz as "||LineNumber||"file_id.diz"
  127. call writeln Tfile, 'endcli'
  128.  
  129. call close Tfile
  130.  
  131. address command "execute T:DIZLIST.BAT"
  132.  
  133.  
  134. if exists(diztemp||LineNumber||"file_id.diz") then do
  135.  
  136.  string=""
  137.  call output
  138.  string="I found a FILE_ID.DIZ file in "Filename.i""
  139.  call output
  140.  string="and copied it as a Long Description "
  141.  call output
  142.  string=""
  143.  call output
  144.  string="Please select N or hit <ENTER> at  "
  145.  call output
  146.  string="the "Would you like to add a LONG description" prompt, to use the new"
  147.  call output
  148.  string="FILE_ID.DIZ description, or Y to add you own long description"
  149.  call output
  150.  string=""
  151.  call output
  152.  address command "copy "||diztemp||LineNumber||"FILE_ID.DIZ TO "descpath||filename.i||".DESC"
  153.  address command "wait 2"
  154.  
  155.  address command "delete t:filelist.txt"
  156.  address command "delete t:DIZLIST.BAT"
  157.  address command "delete "||diztemp||Linenumber||"#?.#?"
  158. return
  159. end
  160.  
  161. else do
  162.  string="No FILE_ID.DIZ found in "Filename.i""
  163.  call output
  164.  string="You may enter a long description if you wish."
  165.  call output
  166. address command "delete "||diztemp||Linenumber||"#?.#?"
  167. end
  168. return
  169.  
  170. output:
  171. call message doorname,linenumber,string,1
  172. return
  173.